define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'wdsxh/member_pay/index' + location.search,
                }
            });

            var table = $("#table");
            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'createtime',
                columns: [
                    [
                        {field: 'user.avatar', title: __('用户头像'),operate: false,events: Table.api.events.image,formatter: Table.api.formatter.image},
                        {field: 'user.nickname', title: __('用户昵称')},
                        {field: 'member.name', title: __('会员姓名')},
                        {field: 'level.name', title: __('入会级别')},
                        {field: 'money', title: __('缴费费用')},
                        {field: 'status', title: __('缴费状态'),searchList: {"0":'已关闭',"1":'待支付',"2":'已支付',"3":'支付失败',"4":'已退款',"5":'后台添加'}, formatter: Table.api.formatter.status},
                        {field: 'paytime', title: __('缴费时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        {
                            field: 'buttons',
                            width: "120px",
                            title: __('操作'),
                            table: table,
                            events: Table.api.events.operate,


                            formatter: Table.api.formatter.buttons
                        }
                      ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});